Subject: Re: Here's a neat idiom for y'all...
From: [email-masked] (Fred McCall)
Date: Tue, 22 Mar 1994 16:37:26 GMT
Newsgroups: comp.lang.c++,comp.lang.c

Hendrik Jan Veenstra ([email-masked]) wrote:

: But, as some other have pointed out already, this usage is fairly non-standard
: and for many (including myself) it's 'strange' to read.  It just don't look
: good...
: What you want to do is compare ptr to NULL -- i.e. 'if ptr equal to NULL...',
: which would be translated to C thus: "if (ptr == NULL)...".  For me 'if NULL is
: equal to ptr' is illogical, irritating, annoying, silly, ...&*&#$*  :-)

Well, some of us find the overly-verbose 'if (ptr == NULL)'
"illogical, irritating, annoying, silly, ..." and prefer to write it
as 'if (!ptr)'.  This makes prefectly good sense if one merely
remembers that a pointer with a nil value is a pointer which does not
point to a legal object -- in other words, it is an 'un-pointer'.

: ANd besides, any half-decent compiler will emit a warning on construct like
: "if (a = b)", so the probelm is non-existent to begin with.

I hate compilers that do this.  It's one of those messages I turn off
(because this isn't a mistake that I, personally, make -- I make other
mistakes, instead -- and because there are a lot of times when I *am*
doing an assignment in the conditional clause and I don't want my real
errors obscured by a bunch of noisy warnings).

-- 
"Insisting on perfect safety is for people who don't have the balls to live
 in the real world."   -- Mary Shafer, NASA Ames Dryden
------------------------------------------------------------------------------
[email-masked] - I don't speak for others and they don't speak for me.